Skip to content

Allow sleep durations of 1 day or longer #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2020
Merged

Allow sleep durations of 1 day or longer #24

merged 1 commit into from
Feb 21, 2020

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Feb 21, 2020

Previously, sleep durations "overflowed" at one day, resulting in a maximum sleep duration of 1 millisecond less than a day.

Demonstration sketch:

#include <ArduinoLowPower.h>

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  LowPower.sleep(24 * 60 * 60 * 1000);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(100);
  digitalWrite(LED_BUILTIN, LOW);
  delay(100);
}

The expected behavior of the above code is the LED should start blinking after the sleep of 24 hours ends. With the current library code, the sleep ends, and LED starts blinking, immediately.

Fixes #22

Previously, sleep durations "overflowed" at one day, resulting in a maximum sleep duration of 1 millisecond less than a day.
@facchinm
Copy link
Contributor

Merging, thank you so much!

@facchinm facchinm merged commit c1b24fb into arduino-libraries:master Feb 21, 2020
@per1234 per1234 deleted the fix-day-sleeps branch February 22, 2020 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LowPower.DeepSleep 24h doesn't work
2 participants